#include "SceneManager.h"

using namespace GalliumEngine;


SceneManager::SceneManager(void) : Singleton<SceneManager>()
{
}

SceneManager::~SceneManager(void)
{
}

void SceneManager::initialize()
{
}

void SceneManager::deinitialize()
{
	for (scenes_map_const_itr i = scenes.begin(); i != scenes.end(); ++i)
	{
		i->second->deinitialize();
		delete i->second; 
	}

	scenes.clear();
}

void SceneManager::AddScene(Scene* scene)
{
	this->scenes.insert(scenes_pair(scene->getId(),scene));
	if(scenes.size() == 1)
	{
		activeScene = scenes[scene->getId()];
	}
}

void SceneManager::switchScreen(std::string scene)
{
	activeScene = scenes[scene];
}

Scene* SceneManager::GetActiveScene()
{
	return activeScene;
}

Scene* SceneManager::getScene(std::string scene)
{
	return this->scenes[scene];
}

void SceneManager::update(float delta)
{
	activeScene->update(delta);
}

void SceneManager::draw()
{
	activeScene->draw();
}
